package com.ky.user.controller;


import cn.hutool.core.convert.NumberWithFormat;
import com.ky.common.config.SystemConfig;
import com.ky.common.util.JwtUtil;
import com.ky.common.vo.R;

import com.ky.user.service.LearnMoneyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hmt
 * @since 2024-06-24
 */
@RestController
@RequestMapping("/user/balance")
public class LearnMoneyController {
    @Autowired
    private LearnMoneyService learnMoneyService;

    @RequestMapping("/findAllLearnMoney")
    public R findALLLearnMoney(HttpServletRequest request){
        String token = request.getHeader(SystemConfig.HEADER_TOKEN);

        Integer id = ((NumberWithFormat) JwtUtil.parseToken(token, "id")).intValue();
        return learnMoneyService.findALLLearnMoney(id);
    }
}

